Skip to content

Fix: [BADA-353] 중복 게시글 방지#375

Merged
marineAqu merged 3 commits intodevelopfrom
fix/BADA-353-fix-response-duplicate-post
Aug 4, 2025
Merged

Fix: [BADA-353] 중복 게시글 방지#375
marineAqu merged 3 commits intodevelopfrom
fix/BADA-353-fix-response-duplicate-post

Conversation

@marineAqu
Copy link
Copy Markdown
Contributor

#️⃣연관된 이슈

close: #372

🚀 작업 내용

  • 추천 API 수정
  • 실시간 게시글 API 수정
  • 벡터값 update 임시 API 삭제

🔍 리뷰 요청 사항

@marineAqu marineAqu added this to the 💰 거래 milestone Aug 4, 2025
@marineAqu marineAqu self-assigned this Aug 4, 2025
@marineAqu marineAqu added the 🐞 BugFix Something isn't working label Aug 4, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements duplicate post prevention for the trending posts and recommendation APIs. The primary purpose is to ensure that posts already included in recommendation results are not duplicated when filling the remaining slots with recent posts.

  • Added exclusion logic to prevent duplicate posts in trending post results
  • Removed unused temporary vector update API and related method
  • Updated repository method to accept excluded post IDs parameter

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TrendingPostService.java Added logic to collect existing post IDs and pass them as exclusion criteria
PostQueryRepository.java Updated interface method signature to accept excluded post IDs
PostQueryRepositoryImpl.java Implemented exclusion logic in the query using notIn clause
RecommendService.java Removed unused updateAllPostVector method and transaction import
RecommendController.java Removed unused vector update endpoint

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

Failed to generate code suggestions for PR

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

Overall Project 15.06% -0.2%
Files changed 0%

File Coverage
TrendingPostService.java 2.14% -10.16%
RecommendService.java 1.65% 🍏
PostQueryRepositoryImpl.java 0% -1.06%
RecommendController.java 0% 🍏

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 4, 2025

Walkthrough

이번 변경에서는 RecommendControllerRecommendService에서 게시글 벡터 일괄 업데이트 관련 엔드포인트 및 메서드가 제거되었습니다. 또한, PostQueryRepository와 그 구현체의 getRecentPostsBySize 메서드가 최근 게시글 조회 시 특정 게시글 ID 집합을 제외할 수 있도록 시그니처와 내부 로직이 수정되었습니다. 마지막으로, TrendingPostService의 인기 게시글 조회 로직에서 중복 게시글이 결과에 포함되지 않도록 이미 포함된 게시글 ID를 제외하여 추가 게시글을 가져오도록 변경되었습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6a55ec and 7a361c4.

📒 Files selected for processing (1)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/BADA-353-fix-response-duplicate-post

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1778828 and a6a55ec.

📒 Files selected for processing (5)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/controller/RecommendController.java (0 hunks)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java (2 hunks)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java (2 hunks)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java (0 hunks)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java (2 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/com/TwoSeaU/BaData/domain/trade/controller/RecommendController.java
  • src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:77-86
Timestamp: 2025-08-01T04:20:26.108Z
Learning: TrendingPostService에서 Redis TTL 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 만료되어 트렌딩 목록이 정기적으로 갱신되도록 하는 설계 의도이다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:47-58
Timestamp: 2025-08-01T03:24:12.001Z
Learning: BaData 프로젝트에서는 게시글 삭제 시 하드 삭제가 아닌 isDeleted 플래그를 사용한 소프트 삭제 방식을 사용한다. 따라서 Redis에 존재하는 게시글 ID가 DB에서 찾을 수 없는 경우는 데이터 무결성 문제로 간주하여 예외를 발생시키는 것이 올바른 처리 방식이다.
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#195
File: src/main/java/com/TwoSeaU/BaData/domain/trade/controller/OCRController.java:26-30
Timestamp: 2025-07-22T14:22:12.563Z
Learning: OCRController는 임시 분리된 컨트롤러로, 추후 PostService로 통합될 예정이므로 현재 단계에서는 파일 검증 로직을 별도로 구현하지 않고 통합 시점에 기존 PostService의 검증 로직을 활용하는 것이 개발 전략이다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#269
File: src/main/java/com/TwoSeaU/BaData/domain/trade/controller/MockController.java:24-27
Timestamp: 2025-07-28T01:53:53.618Z
Learning: marineAqu prefers to keep method names as-is in temporary Mock APIs that are planned for deletion, prioritizing development efficiency over perfect naming conventions for code that will be removed later.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#365
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/PostSearchService.java:44-44
Timestamp: 2025-08-03T14:04:42.957Z
Learning: marineAqu는 개별 API의 완벽한 구현보다는 모든 API 간의 일관된 구현 패턴을 유지하는 것을 우선시한다. 보안이나 성능 개선 사항이 있더라도 전체 시스템에 대한 논의 후 일괄 적용하는 것을 선호한다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#358
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java:155-169
Timestamp: 2025-08-03T04:35:46.490Z
Learning: marineAqu는 곧 삭제될 예정인 API의 경우, 최적화보다는 개발 효율성을 우선시하여 현재 구현을 임시로 유지하는 것을 선호한다. 삭제될 코드에 대해서는 완벽한 구현보다는 개발 속도를 중시한다.
📚 Learning: trendingpostservice에서 redis ttl 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 ...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:77-86
Timestamp: 2025-08-01T04:20:26.108Z
Learning: TrendingPostService에서 Redis TTL 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 만료되어 트렌딩 목록이 정기적으로 갱신되도록 하는 설계 의도이다.

Applied to files:

  • src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java
📚 Learning: in the updatepostrequest class at src/main/java/com/twoseau/badata/domain/trade/dto/request/updatepo...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#146
File: src/main/java/com/TwoSeaU/BaData/domain/trade/dto/request/UpdatePostRequest.java:5-5
Timestamp: 2025-07-18T05:48:30.088Z
Learning: In the UpdatePostRequest class at src/main/java/com/TwoSeaU/BaData/domain/trade/dto/request/UpdatePostRequest.java, the user explicitly stated they don't use the default constructor and are handling JSON deserialization differently, rejecting the suggestion to add @NoArgsConstructor alongside @AllArgsConstructor.

Applied to files:

  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java
  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java
📚 Learning: in java, when classes are in the same package, no import statement is needed. classes in the same pa...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#118
File: src/main/java/com/TwoSeaU/BaData/domain/trade/entity/Payment.java:32-32
Timestamp: 2025-07-15T06:31:54.894Z
Learning: In Java, when classes are in the same package, no import statement is needed. Classes in the same package can reference each other directly without explicit imports. This applies to the Post entity in the Payment.java file where both are in the com.TwoSeaU.BaData.domain.trade.entity package.

Applied to files:

  • src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (4)
src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java (1)

10-10: LGTM! 인터페이스 시그니처 변경이 적절합니다.

중복 게시글 방지를 위해 excludedPostIds 매개변수를 추가한 것이 올바른 접근입니다. Set 타입 사용도 적절합니다.

Also applies to: 20-20

src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java (2)

20-20: LGTM! 필요한 import가 추가되었습니다.

중복 방지 로직에서 사용할 Collectors.toSet()을 위한 import가 적절히 추가되었습니다.


61-64: LGTM! 중복 게시글 방지 로직이 올바르게 구현되었습니다.

이미 포함된 게시글의 ID를 수집하여 getRecentPostsBySize 호출 시 제외하는 로직이 정확합니다. Stream을 사용한 ID 수집과 Set으로의 변환도 효율적입니다.

src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java (1)

5-5: LGTM! 필요한 import가 추가되었습니다.

Set 타입 사용을 위한 import가 적절히 추가되었습니다.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

Overall Project 15.06% -0.24%
Files changed 0%

File Coverage
TrendingPostService.java 2.14% -10.16%
RecommendService.java 1.65% 🍏
PostQueryRepositoryImpl.java 0% -1.8%
RecommendController.java 0% 🍏

Copy link
Copy Markdown
Contributor

@choyunju choyunju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@marineAqu marineAqu merged commit 6082fb5 into develop Aug 4, 2025
1 check passed
@marineAqu marineAqu deleted the fix/BADA-353-fix-response-duplicate-post branch August 4, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BADA-353] [BUG] 중복 게시글 반환 수정

3 participants